<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class TableCtmonProductsExtCatRelationsCreate extends AbstractMigration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change(): void
    {
        $table = $this->table('ctmon_products_ext_cat_relations', [
                    'id' => false,
                    'primary_key' => ['id'],
                    'engine' => 'InnoDB',
                    'signed' => false,
                    'collation' => 'utf8mb4_general_ci',
                    'comment' => '产品拓展分类关联关系表||']);
                $table->addColumn('id', 'biginteger', ['limit' => 20, 'signed' => false, 'identity' => true, 'null' => false, 'comment' => 'id'])
                    ->addColumn('product_id', 'integer', ['limit' => 10, 'default' => 0, 'comment' => '产品id'])
                    ->addColumn('cat_id', 'integer', ['limit' => 10, 'default' => 0, 'comment' => '产品分类id'])
                    ->create();
    }
}
